	 
TARGET = ../output/xunyi_mav_control_x

OBJECTS = main.o controller_3D_posPID.o controller_posPID.o autopilot_interface.o serial_port.o waypoint_list.o ref_navigator.o ultrasonic.o filter_j1.o uart_common.o tinyxml2.o commander.o \
thread_common_op.o aruco.o dictionary.o charuco.o fisheye.o getTargetLoc.o inifile.o xy_vision.o integrator_time.o log.o speed_test.o wireless_debug.o HealthManage.o controller_angPID.o times_counter.o
#      

CFLAGS = -Wall -O3 -DPLATFORM_LINUX -DTINYXML_CFG -I../src/mavlink/ -I/usr/local/include/opencv -I/usr/local/include
#-Wall -O3 -DPLATFORM_LINUX -DTINYXML_CFG 
#-I/usr/local/include/opencv -I/usr/local/include

LDFLAGS = -lpthread /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so \
/usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so \
/usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_ocl.so /usr/local/lib/libopencv_photo.so \
/usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so -lrt -ldl -lcurl  -lm 


CXX = g++ 
#-pg -g -rdynamic

$(TARGET) : $(OBJECTS)
	$(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS)
	
main.o : ../src/main.cpp
	$(CXX) $(CFLAGS) -c ../src/main.cpp
	
tinyxml2.o : ../src/common/tinyxml2.cpp
	$(CXX) $(CFLAGS) -c ../src/common/tinyxml2.cpp
	
controller_3D_posPID.o : ../src/controller/controller_3D_posPID.cpp
	$(CXX) $(CFLAGS) -c ../src/controller/controller_3D_posPID.cpp
	
controller_posPID.o : ../src/controller/controller_posPID.cpp
	$(CXX) $(CFLAGS) -c ../src/controller/controller_posPID.cpp
	
controller_angPID.o : ../src/controller/controller_angPID.cpp
	$(CXX) $(CFLAGS) -c ../src/controller/controller_angPID.cpp
	
autopilot_interface.o : ../src/pilot/autopilot_interface.cpp
	$(CXX) $(CFLAGS) -c ../src/pilot/autopilot_interface.cpp
	
serial_port.o : ../src/pilot/serial_port.cpp
	$(CXX) $(CFLAGS) -c ../src/pilot/serial_port.cpp
	
waypoint_list.o : ../src/navigator/waypoint_list.cpp
	$(CXX) $(CFLAGS) -c ../src/navigator/waypoint_list.cpp
	
ref_navigator.o : ../src/navigator/ref_navigator.cpp
	$(CXX) $(CFLAGS) -c ../src/navigator/ref_navigator.cpp
	
aruco.o : ../src/vision/aruco.cpp
	$(CXX) $(CFLAGS) -c ../src/vision/aruco.cpp
	
charuco.o : ../src/vision/charuco.cpp
	$(CXX) $(CFLAGS) -c ../src/vision/charuco.cpp
	
dictionary.o : ../src/vision/dictionary.cpp
	$(CXX) $(CFLAGS) -c ../src/vision/dictionary.cpp
		
fisheye.o : ../src/vision/fisheye.cpp
	$(CXX) $(CFLAGS) -c ../src/vision/fisheye.cpp
	
getTargetLoc.o : ../src/vision/getTargetLoc.cpp
	$(CXX) $(CFLAGS) -c ../src/vision/getTargetLoc.cpp
	
inifile.o : ../src/vision/inifile.c
	$(CXX) $(CFLAGS) -c ../src/vision/inifile.c
		
uart_common.o : ../src/vision/common/uart_common.cpp
	$(CXX) $(CFLAGS) -c ../src/vision/common/uart_common.cpp
	
xy_vision.o : ../src/vision/xy_vision.cpp
	$(CXX) $(CFLAGS) -c ../src/vision/xy_vision.cpp
	
thread_common_op.o : ../src/vision/thread_common_op.cpp
	$(CXX) $(CFLAGS) -c ../src/vision/thread_common_op.cpp
	
filter_j1.o : ../src/filter/filter_j1.cpp
	$(CXX) $(CFLAGS) -c ../src/filter/filter_j1.cpp
	
ultrasonic.o : ../src/ultrasonic/ultrasonic.cpp
	$(CXX) $(CFLAGS) -c ../src/ultrasonic/ultrasonic.cpp

commander.o : ../src/commander/commander.cpp
	$(CXX) $(CFLAGS) -c ../src/commander/commander.cpp
	
integrator_time.o : ../src/common/integrator_time.cpp
	$(CXX) $(CFLAGS) -c ../src/common/integrator_time.cpp
	
log.o : ../src/log/log.cpp
	$(CXX) $(CFLAGS) -c ../src/log/log.cpp
	
speed_test.o : ../src/rotate_speed/speed_test.cpp
	$(CXX) $(CFLAGS) -c ../src/rotate_speed/speed_test.cpp
	
		
wireless_debug.o : ../src/wireless_debug/wireless_debug.cpp
	$(CXX) $(CFLAGS) -c ../src/wireless_debug/wireless_debug.cpp
	
HealthManage.o : ../src/HealthManage/HealthManage.cpp
	$(CXX) $(CFLAGS) -c ../src/HealthManage/HealthManage.cpp
	
times_counter.o : ../src/counter/times_counter.cpp
	$(CXX) $(CFLAGS) -c ../src/counter/times_counter.cpp
	
clean:
	-rm *.o
	-rm $(TARGET)
